import urllib.request
import ssl

url = 'https://www.12306.cn/mormhweb/'
headers = {
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
}

# 忽略认证
context = ssl._create_unverified_context()

# 创建 sssl的处理器
handler = urllib.request.HTTPSHandler(context=context)


#
opener = urllib.request.build_opener(handler)

# opener.open
response = opener.open(url).read()


result = response.decode()
with open('08ssl.html', 'w') as f:
    f.write(result)



